package com.dynamixsoftware.printershare;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import com.box.onecloud.android.BoxOneCloudReceiver;
import com.box.onecloud.android.OneCloudData;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;

public class BoxOneCloud
  extends BoxOneCloudReceiver
{
  public void onCreateFileRequested(Context paramContext, OneCloudData paramOneCloudData) {}
  
  public void onEditFileRequested(Context paramContext, OneCloudData paramOneCloudData) {}
  
  public void onLaunchRequested(Context paramContext, OneCloudData paramOneCloudData)
  {
    Intent localIntent = new Intent(paramContext, ActivityMain.class);
    localIntent.setFlags(335544320);
    paramContext.startActivity(localIntent);
  }
  
  public void onViewFileRequested(Context paramContext, OneCloudData paramOneCloudData)
  {
    String str;
    Intent localIntent;
    File localFile;
    InputStream localInputStream;
    FileOutputStream localFileOutputStream;
    for (;;)
    {
      try
      {
        str = paramOneCloudData.getMimeType();
        localIntent = new Intent("android.intent.action.VIEW");
        localFile = new File(App.getTempDir(), "printershare_doc.tmp");
        if (str.startsWith("image/"))
        {
          localIntent.setClass(paramContext, ActivityPrintPictures.class);
          localInputStream = paramOneCloudData.getInputStream();
          localFileOutputStream = new FileOutputStream(localFile);
          byte[] arrayOfByte = new byte[4096];
          int i = localInputStream.read(arrayOfByte);
          if (i == -1) {
            break;
          }
          localFileOutputStream.write(arrayOfByte, 0, i);
          continue;
        }
        if (!str.equals("text/html")) {
          break label134;
        }
      }
      catch (Exception localException)
      {
        localException.printStackTrace();
        App.reportThrowable(localException);
        return;
      }
      localIntent.setClass(paramContext, ActivityPrintWeb.class);
      continue;
      label134:
      if (str.equals("application/pdf")) {
        localIntent.setClass(paramContext, ActivityPrintPDF.class);
      } else {
        localIntent.setClass(paramContext, ActivityPrintDocuments.class);
      }
    }
    localFileOutputStream.close();
    localInputStream.close();
    localIntent.setDataAndType(Uri.parse("file://" + localFile.getAbsolutePath()), str);
    localIntent.setFlags(335544320);
    paramContext.startActivity(localIntent);
  }
}


/* Location:           C:\Users\Admin\Desktop\Decompiler\JAD\jd-gui-0.3.6.windows\classes_dex2jar.jar
 * Qualified Name:     com.dynamixsoftware.printershare.BoxOneCloud
 * JD-Core Version:    0.7.0.1
 */